Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add size to versions #484

Merged
merged 7 commits into from Jul 12, 2013
Merged

Add size to versions #484

merged 7 commits into from Jul 12, 2013

Conversation

gnarg
Copy link
Contributor

@gnarg gnarg commented Nov 4, 2012

Up to date version of cmeiklejohn's pull request #310

@@ -28,6 +28,15 @@ def save
end
end

def size_gem
if body
@size = body.size
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could probably memoize this

@size ||= body.size

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it's really necessary if we only use it once.

@cmeiklejohn cmeiklejohn mentioned this pull request Nov 6, 2012
@@ -4,6 +4,9 @@
<% if version.platformed? %>
<span class="platform"><%= version.platform %></span>
<% end %>
<% if version.sized? %>
<span class="size">(<%= number_to_human_size(version.size) %>)</span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get rid of the if and make version.size return "NA" if there is no size? It would follow tell don't ask, and make the view more consistant on how it looks?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this approach. N/A sounds fine to me!

@adkron
Copy link
Contributor

adkron commented Nov 7, 2012

@gnarg Are you still working on this or do you need someone else to finish it off? I don't want to sweep in if someone is actively working on this.

@gnarg
Copy link
Contributor Author

gnarg commented Nov 7, 2012

Hi, sorry, yeah, I'll incorporate the suggestions here and resubmit, hopefully today.

I was trying to get caught up after RubyConf, but I think I have some time now. The Hack-a-thon / BoF thing at RubyConf was a lot of fun and I'd like to get this landed if possible.

Thanks.

@cmeiklejohn
Copy link
Contributor

Cool, just let us know when it's good to go, we'll get it merged and coordinate the deployment with the rake task to backfill the version numbers. Thanks!

@gnarg
Copy link
Contributor Author

gnarg commented Nov 8, 2012

Ok, I think I incorporated all the given suggestions. Should be ok to merge unless there are more ideas for improvements.

@adkron
Copy link
Contributor

adkron commented Nov 8, 2012

:shipit: or 🚢 it
Ship It!

Version.find_in_batches do |versions|
versions.each do |version|
print "sizing #{version.full_name}: "
file = fog.directories.get($rubygems_config[:s3_bucket] + '/gems') \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This... is going to take a really, really long time.

1.9.3p0 :001 > Version.indexed.count
   (172.1ms)  SELECT COUNT(*) FROM "versions" WHERE "versions"."indexed" = 't'
 => 253733

Maybe there's a better way we can do this with S3? Some kind of export of data? /cc @geemus

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we roll some ec2 instances to compute the sizes of all of the gems on s3 and create a file of sizes and then use that to import on the main gemcutter instances? This way, i/o to AWS is free for all of the EC2 operations and we can leave it running somewhere without worrying about site performance?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can absolutely spin up EC2 instances to update the sizes. That can be done async after this change is merged in.

@qrush
Copy link
Member

qrush commented Nov 8, 2012

Reviewed, this is not ready to merge yet.

@@ -46,7 +55,7 @@ def pull_spec

def find
@rubygem = Rubygem.find_or_initialize_by_name(spec.name)
@version = @rubygem.find_or_initialize_version_from_spec(spec)
@version = @rubygem.find_or_initialize_version_from_spec_and_size(spec, size)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we use the size to look up the version? Why would we create the same version with different sizes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. The method is named badly, it doesn't actually use the size to search. As @qrush says below, nuke this method.

@gnarg
Copy link
Contributor Author

gnarg commented Nov 9, 2012

I cleaned up some of the objectionable code. @cmeiklejohn I hope you don't mind too much that I'm basically rewriting your code here.

@gnarg
Copy link
Contributor Author

gnarg commented Nov 15, 2012

Any more feedback on this? It's worth noting that the travis failure was a transient github outtage:

https://travis-ci.org/rubygems/rubygems.org/jobs/3124922

@adkron
Copy link
Contributor

adkron commented Nov 28, 2012

@qrush What should be done on this to make it ready?

@zenspider
Copy link

Bueller?

@evanphx
Copy link
Member

evanphx commented Jul 12, 2013

Merging and deploying tomorrow (7/12/2013)

@evanphx evanphx merged commit ebbc2b6 into rubygems:master Jul 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants